#ifndef HTTPD_CGI_H
#define HTTPD_CGI_H

#ifdef __cplusplus
extern "C" {
#endif

#define HTTPD_CGI_PARAM_DEFINE(param, _set_cb) \
    static void __attribute__((constructor)) _http_cgi_client_ ## _set_cb(void) { \
        static httpd_cgi_param _file;  \
        httpd_cgi_add_param(&_file, param, _set_cb); \
    }

typedef struct _httpd_cgi_param {
    struct _httpd_cgi_param *next;
    const char *param;
    void (*set_cb)(char *value);
} httpd_cgi_param;

void httpd_cgi_init(void);
void httpd_cgi_add_param(httpd_cgi_param *client, const char *param, void (*set_cb)(char *value));

#ifdef __cplusplus
}
#endif

#endif
